package com.bitdf.txing.product.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.bitdf.txing.common.entity.BaseEntity;
import com.bitdf.txing.common.valid.SaveGroup;
import com.bitdf.txing.common.valid.UpdateGroup;
import com.bitdf.txing.common.valid.anno.ListValue;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 品牌
 *
 * @author lizhiwei
 * @email sunlightcs@gmail.com
 * @date 2022-05-16 20:22:24
 */
@Data
@TableName("tx_pms_brand")
public class BrandEntity extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌名
     */
    @NotBlank(message = "品牌名必须提交", groups = {SaveGroup.class, UpdateGroup.class})
    private String name;
    /**
     * 品牌logo地址
     */
    @NotBlank(groups = {SaveGroup.class})
    @URL(message = "logo必须是一个合法的url地址", groups = {SaveGroup.class, UpdateGroup.class})
    private String logo;
    /**
     * 介绍
     */
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    @NotNull(groups = {SaveGroup.class})
    @ListValue(vals = {0, 1}, groups = {SaveGroup.class, UpdateGroup.class})
    private Byte showStatus;
    /**
     * 检索首字母
     */
    @NotEmpty(groups = {SaveGroup.class})
    @Pattern(regexp = "^[a-zA-Z]$", message = "必须为一个字母", groups = {SaveGroup.class, UpdateGroup.class})
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull(groups = SaveGroup.class)
    @Min(value = 0, message = "必须大于等于0", groups = {SaveGroup.class, UpdateGroup.class})
    private Integer sort;

}
